/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package admin.Controller;

import admin.BusinessLogic.BusinessLogic;
import admin_gui.Admin_InventoryReport;
import admin_gui.Admin_Manage;
import admin_gui.Admin_SelectAreaReport;
import admin_gui.Admin_SelectItemsReport;
import admin_gui.Admin_SelectStoreReport;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;

/**
 *
 * @author WEN
 */
public class ReportManageController {

  //  private Admin_Manage adminManage;
  //  private JPanel mainPanel;
    private BusinessLogic businessLogic;

    public ReportManageController(Admin_Manage aThis, JPanel MainPanel) {
        try {
            //    adminManage = aThis;
            //    mainPanel = MainPanel;
            businessLogic = new BusinessLogic();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(ReportManageController.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(ReportManageController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void manageOperation(boolean[] manageItem, JPanel mainPanel) {
        for (int i = 0; i < manageItem.length; i++) {
            if (manageItem[i] == true) {
                showGenerateReportPanel(i, mainPanel);
            }
        }
    }

    private void showGenerateReportPanel(int i, JPanel panel) {
        switch (i) {
            case 0:
                Admin_SelectItemsReport selectItemPane = new Admin_SelectItemsReport(
                        panel);
                selectItemPane.setBounds(1, 1, 762, 613);
                panel.removeAll();
                panel.add(selectItemPane);
                panel.validate();
       //         System.out.println("show item");
                panel.repaint();
                break;
            case 1:
                Admin_SelectAreaReport selectAreaPane = new Admin_SelectAreaReport(
                        panel);
                selectAreaPane.setBounds(1, 1, 762, 613);
                panel.removeAll();
                panel.add(selectAreaPane);
                panel.validate();
       //         System.out.println("show area");
                panel.repaint();
                break;
            case 2:
                Admin_SelectStoreReport selectStorePane = new Admin_SelectStoreReport(
                        panel);
                selectStorePane.setBounds(1, 1, 762, 613);
                panel.removeAll();
                panel.add(selectStorePane);
                panel.validate();
      //          System.out.println("show store");
                panel.repaint();
                break;
            case 3:
                Vector storeName = new Vector();
                storeName = businessLogic.getStore();
                Admin_InventoryReport selectInventoryPane = new Admin_InventoryReport(
                        panel, storeName);
                selectInventoryPane.setBounds(1, 1, 762, 613);
                panel.removeAll();
                panel.add(selectInventoryPane);
                panel.validate();
       //         System.out.println("show inventory");
                panel.repaint();
                break;
        }
    }
}
